package com.vibration.web.controller.baseinfo;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.vibration.common.annotation.Log;
import com.vibration.common.core.controller.BaseController;
import com.vibration.common.core.domain.AjaxResult;
import com.vibration.common.enums.BusinessType;
import com.vibration.baseinfo.domain.CzGroundWaterData;
import com.vibration.baseinfo.service.ICzGroundWaterDataService;
import com.vibration.common.utils.poi.ExcelUtil;
import com.vibration.common.core.page.TableDataInfo;

/**
 * 地下水脉数据Controller
 * 
 * @author Mr_Wu
 * @date 2023-03-20
 */
@RestController
@RequestMapping("/baseinfo/waterData")
public class CzGroundWaterDataController extends BaseController
{
    @Autowired
    private ICzGroundWaterDataService czGroundWaterDataService;

    /**
     * 查询地下水脉数据列表
     */
    @PreAuthorize("@ss.hasPermi('baseinfo:waterData:list')")
    @GetMapping("/list")
    public TableDataInfo list(CzGroundWaterData czGroundWaterData)
    {
        startPage();
        List<CzGroundWaterData> list = czGroundWaterDataService.selectCzGroundWaterDataList(czGroundWaterData);
        return getDataTable(list);
    }

    /**
     * 导出地下水脉数据列表
     */
    @PreAuthorize("@ss.hasPermi('baseinfo:waterData:export')")
    @Log(title = "地下水脉数据", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, CzGroundWaterData czGroundWaterData)
    {
        List<CzGroundWaterData> list = czGroundWaterDataService.selectCzGroundWaterDataList(czGroundWaterData);
        ExcelUtil<CzGroundWaterData> util = new ExcelUtil<CzGroundWaterData>(CzGroundWaterData.class);
        util.exportExcel(response, list, "地下水脉数据数据");
    }

    /**
     * 获取地下水脉数据详细信息
     */
    @PreAuthorize("@ss.hasPermi('baseinfo:waterData:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return AjaxResult.success(czGroundWaterDataService.selectCzGroundWaterDataById(id));
    }

    /**
     * 新增地下水脉数据
     */
    @PreAuthorize("@ss.hasPermi('baseinfo:waterData:add')")
    @Log(title = "地下水脉数据", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody CzGroundWaterData czGroundWaterData)
    {
        return toAjax(czGroundWaterDataService.insertCzGroundWaterData(czGroundWaterData));
    }

    /**
     * 修改地下水脉数据
     */
    @PreAuthorize("@ss.hasPermi('baseinfo:waterData:edit')")
    @Log(title = "地下水脉数据", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody CzGroundWaterData czGroundWaterData)
    {
        return toAjax(czGroundWaterDataService.updateCzGroundWaterData(czGroundWaterData));
    }

    /**
     * 删除地下水脉数据
     */
    @PreAuthorize("@ss.hasPermi('baseinfo:waterData:remove')")
    @Log(title = "地下水脉数据", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(czGroundWaterDataService.deleteCzGroundWaterDataByIds(ids));
    }
}
